<!DOCTYPE html>     
<html>     
<head>     
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />   
<meta name="viewport" content="width=device-width, initial-scale=1">  

<!-- jquery mobile的js -->
<link rel="stylesheet" type="text/css" href="./js/jquery_mobile/jquery.mobile-1.4.5/jquery.mobile-1.4.5.css">
<script type="text/javascript" src="./js/jquery_mobile/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="./js/jquery_mobile/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.js"></script>


<!-- 百度地图的js -->
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=C6CeaML6mI3ICzKkMYom2sTtDcFSvxNY"/>

<!-- 省市级联的js -->
<script src="./js/jquery-1[1].2.6.js" type="text/javascript"></script>
<script src="./js/jquery.provincesCity.js" type="text/javascript"></script>
<script src="./js/provincesdata.js" type="text/javascript"></script> 

<link rel="stylesheet" href="./css/index.css" />

<style type="text/css">

</style>
</head>               
<body>



<!----------------------------主页--------------------------------------------->

<script>

//定义几个全局变量 
var AppUrl = "http://127.0.0.1:8888";//整个页面的请求页面



function showImgIndex(indexs){
		
		//alert(indexs);
		
		for(var i=0;i<=2;i++){
			if(indexs-1 == i){
				$(".run1").eq(i).css("display","block"); 
			}else{
				$(".run1").eq(i).css("display","none"); 
			}
		}
	
}

var timeIndex = 0;
function chvalue(){ 
	if(timeIndex == 3){
		timeIndex = 0;
	} 
    for(var i=0;i<=2;i++){
			if(timeIndex == i){
				$(".run1").eq(i).css("display","block"); 
			}else{
				$(".run1").eq(i).css("display","none"); 
			}
	}
	timeIndex++;
}  
window.setInterval(chvalue, 2000);  


//设置全局变量用来保存商品信息
var  goods_id_detail = null;
var  goods_name_detail = null;
var  goods_price_detail = null;
var  goods_desc_detail = null;
var  file_name_detail = null;





$(function(){
	
	
	
	//热卖初始化
	$.ajax( {  
      url:AppUrl+'/forestage/Goods/findGoodsByDate',// 跳转到 action  addUser
      data:{},  
     type:'post',  
     cache:false, 
	 xhrFields: {
        withCredentials: true
      },
     dataType:'json',  
     success:function(data) {  
       //alert("返回数据"+data);
		var str = '';
		for(var i=0;i<data.length;i++){
			str += "<div style='background-color:#FFFFFF;float:left;width:46%;margin-top:5px;margin-left:2px;padding:4px;border:1px solid gray;'>";
				str += "<a  href='#pageDetail' onclick=\"setGoodsInformation('"+data[i]._id+"','"+data[i].goods_name+"','"+data[i].goods_price+"','"+data[i].goods_desc+"','"+data[i].file_name+"')\" >";
					str += "<div style='float:left;width:100%;'>";
						str += "<img style='width:100%;float:left;' src='http://biluo.oss-cn-qingdao.aliyuncs.com/"+data[i].file_name+"' />";
						
					str += "</div>";
				str += "</a>";
			str += "</div>";
		
		}
		document.getElementById("show_hot_close").innerHTML = str;
      },  
      error : function() {  
           alert("热卖初始化异常！");  
      }  
	});
	
	
	
	
	
	//商家推荐列表初始化
	$.ajax( {  
     url:AppUrl+'/forestage/Goods/findAllGoodsByDate',// 跳转到 action  addUser
     data:{},  
     type:'post',  
     cache:false,  
     dataType:'json',
	 xhrFields: {
        withCredentials: true
      },	 
     success:function(data) {  
        //alert("返回数据"+data);	
		var str = '';
		for(var i=0;i<data.length;i++){		
			str += "<div style='background-color:#FFFFFF;float:left;width:46%;margin-top:5px;margin-left:2px;padding:4px;border:1px solid gray;'>";
				str += "<a  href='#pageDetail' onclick=\"setGoodsInformation('"+data[i]._id+"','"+data[i].goods_name+"','"+data[i].goods_price+"','"+data[i].goods_desc+"','"+data[i].file_name+"')\" >";
					str += "<div style='float:left;width:100%;'>";
						str += "<img style='width:100%;float:left;' src='http://biluo.oss-cn-qingdao.aliyuncs.com/"+data[i].file_name+"' />";
						str += "<div style='float:left;width:100%;text-align:center;font-size:12px;color:black;'>";
							str += "<p style='text-align:center;font-size:15px;text-align:left;'>"+data[i].goods_name+"</p>";
							str += "<p style='text-align:center;font-size:12px;color:red;text-align:left;'>￥:"+data[i].goods_price+"</p>";
					
						str += "</div>";
					str += "</div>";
				str += "</a>";
			str += "</div>";		
		}
		document.getElementById("index_show_shangJia_tuijian").innerHTML = str;
      },  
      error : function() {  
           alert("商家推荐列表初始化异常！");  
      }  
	});
});



//设置要传递到详细页面商品的参数
function setGoodsInformation(id,goods_name,goods_price,goods_desc,file_name){
	goods_id_detail = id;
	goods_name_detail = goods_name;
	goods_price_detail = goods_price;
	goods_desc_detail = goods_desc;
	file_name_detail = file_name;
}



</script>



<div data-role="page" id="pageOne">
    <div data-role="header" id='myhead'>
		<h1>欢迎访问我的主页</h1>
	</div>
    <div data-role="header" id='myhead2' >
		<a href="#" data-role="none" style="">
			<img src="use_img/back.png" width="30px" height="30px;"/>
		</a>
	  <h1 data-role="none" style="" >
		<input data-role="none" type="text" style="background:none;border-left:none;border-right:none;border-top:none;width:100%;">
	  </h1>
	  <a href="#" data-role="none" style="">
		<img src="use_img/search.png" width="30px" height="30px;"/>
	  </a>
	</div>
    <div data-role="content"  style="width:100%;background-color:#B2A2C3;padding:0;">
	    <!-- 图片轮播代码 -->
		<div id="run" style="width:100%;background-color:red;float:left;">
			<img src="temp_img/run1.jpg" style="display:block;" class="run1"/>
			<img src="temp_img/run2.jpg"  class="run1"/>
			<img src="temp_img/run3.jpg"  class="run1"/>
			<div id="run_bt" >
				<div class="show_img_index" ><a href="#" onMouseOver ="showImgIndex(3)">3</a></div>
				<div class="show_img_index" ><a href="#" onMouseOver ="showImgIndex(2)">2</a></div>
				<div class="show_img_index" ><a href="#" onMouseOver ="showImgIndex(1)">1</a></div>
			</div>
		</div>
		 <!-- 菜单代码 -->
		<div id="menu1" style="width:100%;float:left;">
			<div class="menu1-father1" >
				<a href="">
					<div class="meun1-son1" >
						<img src="use_img/fly.png" />
					</div>
					<div class="meun1-son2"  >
						<p>飞机票</p>
					</div>
				</a>
			</div>
			<div class="menu1-father" >
				<a href="">
					<div class="meun1-son1" >
						<img src="use_img/gou.png" />
					</div>
					<div class="meun1-son2" >
						<p>购物</p>
					</div>
				</a>
			</div>
			<div class="menu1-father1" >
				<a href="#pageTrain">
					<div class="meun1-son1" >
						<img src="use_img/huoche.png" />
					</div>
					<div class="meun1-son2" >
						<p>火车票</p>
					</div>
				</a>
			</div>
			<div class="menu1-father" >
				<a href="#pageMap">
					<div class="meun1-son1" >
						<img src="use_img/map.png" />
					</div>
					<div class="meun1-son2" >
						<p>地图</p>
					</div>
				</a>
			</div>
			<div class="menu1-father1" >
				<a href="">
					<div class="meun1-son1" >
						<img src="use_img/meishi.png" />
					</div>
					<div class="meun1-son2" >
						<p>美食</p>
					</div>
				</a>
			</div>
			<div class="menu1-father" >
				<a href="">
					<div class="meun1-son1" >
						<img src="use_img/move.png" />
					</div>
					<div class="meun1-son2" >
						<p>电影</p>
					</div>
				</a>
			</div>
			<div  class="menu1-father1" >
				<a href="#weatherPage">
					<div class="meun1-son1" >
						<img src="use_img/tianqi.png" />
					</div>
					<div class="meun1-son2" >
						<p>天气</p>
					</div>
				</a>
			</div>
			<div class="menu1-father" >
				<a href="">
					<div class="meun1-son1" >
						<img src="use_img/tuan.png"/>
					</div>
					<div class="meun1-son2" >
						<p>团购</p>
					</div>
				</a>
			</div>
			<div class="menu1-father" >
				<a href="#gupiaoPage">
					<div class="meun1-son1" >
						<img src="use_img/gupiao.png"/>
					</div>
					<div class="meun1-son2" >
						<p>股票</p>
					</div>
				</a>
			</div>
			<div class="menu1-father" >
				<a href="">
					<div class="meun1-son1" >
						<img src="use_img/gupiao.png"/>
					</div>
					<div class="meun1-son2" >
						<p>股票</p>
					</div>
				</a>
			</div>
		</div>
		<!-- 热门推荐之衣服 -->
		<div id="hot-close">
			 <div id="hot-close-title">&nbsp;&nbsp;热卖</div>
			 <div id="show_hot_close" ></div>
		</div>
		<!-- 商品列表 -->
		<div id="showList">
			 <div id="hot-close-title2">&nbsp;&nbsp;商家推荐</div>
			 <div id="index_show_shangJia_tuijian" style="width:100%;"></div>
		</div>
	</div>
    <div data-role="footer" data-position="fixed">
			<div data-role="navbar">
				<ul>
					<li><a id="a1" href="13_3.html" data-icon="home">首页</a></li>        
					<li><a id="a2" href="#pageList" data-icon="grid">发现</a></li>        
					<li><a id="a3" href="#pageCenter" data-icon="clock">中心</a></li>        
					<li><a id="a3" href="#pageTwo" data-icon="user">我的</a></li>  
				</ul>
			</div>
	</div>
</div>















<!-- 登录页面 -->
<script>
function login(){
	var userName = $("input[name='userName']").val();
	var userPasswd = $("input[name='userPasswd']").val();
	//alert("username="+userName+" mypasswd="+userPasswd);
	$.ajax( {  
      url:AppUrl+'/forestage/user/userLogin',// 跳转到 action  addUser
      data:{
		"userName":userName,
		'userPasswd':userPasswd
	  },  
     type:'post',  
     cache:false,  
     dataType:'json',  
     success:function(data) {  
        //alert("返回数据--"+data);
		if(data  == 2){
			location.href ="index.html";
		}
      },  
      error : function() {  
           alert("异常！");  
      }  
	});
}
</script>
<div data-role="page" id="pageTwo">
    <div data-role="header" id='myhead-login'>
	    <a href="#pageOne" data-role="none" style="">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	    <h1 data-role="none" id="login-title" >
		  登录
	    </h1>
	    <a href="#" data-role="none" style=""></a>
    </div>
    <div data-role="content"  id="login-content" style="">
		<div id="login-head" >
			<div class="lgin-form"> 
				<img class="image" src="temp_img/close7.png" /> 
			</div>
			<div  class="lgin-form"> 
				<form>
					<input type="text" data-role="none"  class="form-input" value="用户名" name="userName"/>
					<input type="text" data-role="none"  class="form-input" value="密码"   name="userPasswd"/>
					<input type="button" data-role="none" id = "login-bt" value="登录" onclick="login()"/>
				</form>
				<a href="" id="forget-mima">忘记密码</a>
				<a href="#page-for-register" id="new-user">新用户注册</a>
			</div>
			<div  class="lgin-form" id="label-for-three"> 
				<p>第三方登录</p>
			</div>
			<div  class="lgin-form" > 
				<img src="use_img/weixin.png" class="three-login"/>
				<img src="use_img/qq.png"/ class="three-login">
				<img src="use_img/taobao.png" class="three-login"/>
			</div>
		</div>
    </div>
</div>










<!-- 注册页面 -->
<script>
function getMessage(){
$.ajax( {  
      url:AppUrl+'/forestage/user/sendSMS',// 跳转到 action  addUser
      data:{
		"phone":$("#myphone").val(),
		'user':$("#myuser").val()
	  },  
     type:'post',  
     cache:false,  
     dataType:'json', 
	 xhrFields: {
        withCredentials: true
      },	 
     success:function(data) {  
        alert("返回数据--"+data);
		

      },  
      error : function() {  
           // view("异常！");  
           alert("异常！");  
      }  
	});

}


function registerUser(){
	var username = $("#myuser").val();
	var mypasswd = $("#mypasswd").val();
	var myphone = $("#myphone").val();
	var mycode = $("#form-check-text").val();
	//alert("username="+username+" mypasswd="+mypasswd+" myphone="+myphone+"form-check-text"+mycode);
	$.ajax( {  
      url:AppUrl+'/forestage/user/registerUser',// 跳转到 action  addUser
      data:{
		"username":username,
		'mypasswd':mypasswd,
		'myphone':myphone,
		'mycode':mycode
	  },  
     type:'post',  
     cache:false,  
     dataType:'json',
	 xhrFields: {
        withCredentials: true
      },
     success:function(data) {  
        alert("返回数据--"+data);
		if(data == "1"){ //注册失败
			alert("对不起 注册失败");
		}
		if(data == "2"){//注册成功
			alert("恭喜你 注册成功");
			location.href ="index.html";
		}
      },  
      error : function() {  
           // view("异常！");  
           alert("异常！");  
      }  
	});
}

</script>


<div data-role="page" id="page-for-register">
    <div data-role="header" id='myhead-register'>
	  <a href="#pageOne" data-role="none" style="">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	  <h1 data-role="none" id="register-title" >
		注册
	  </h1>
	  <a href="#" data-role="none" style="">
		
	  </a>
    </div>
    <div data-role="content"  id="register-content" style="">
		<div id="register-head" >
			<div class="lgin-form"> 
				<img class="image" src="temp_img/close7.png" /> 
			</div>
			<div  class="lgin-form"> 
				<form>
					<input type="text" data-role="none"  id="myuser" class="form-input" value="用户名"/>
					<input type="text" data-role="none"  id="mypasswd" class="form-input" value="密码"/>
					<input type="text" data-role="none"  id="myphone" class="form-input" value="手机号"/>
					<input type="text" data-role="none"  id="form-check-text" value="验证码"/>
					<input type="button" data-role="none"  id="form-check-button" value="获取验证码" onclick="getMessage()"/>
					<input type="button" data-role="none" id = "register-bt" onclick="registerUser()" value="注册" />
				</form>	
			</div>
		</div>
    </div>
</div>







<!-- 用户中心页面 -->
<div data-role="page" id="pageCenter">
	
	<div data-role="header" id='center-register'>
	  <a href="#pageOne" data-role="none" style="">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	  <h1 data-role="none" id="register-title" >
		个人中心
	  </h1>
	  <a href="#" data-role="none" style="">
		
	  </a>
    </div>
	
    
    <div data-role="content" id="center" >
		<div id="center-head">
			<div id="center-head-img"> 
				<img id="center-head-img-show" src="temp_img/close7.png" /> 
			</div>
			<div id="center-head-name"> 
				会飞的小猪
			</div>
			<div id="center-head-menu1">
				<div class="center-head-menu1-div">
					<a href="">
						<img src="use_img/pay.png"/>
						
					</a>
					<p>待付款</p>
				</div>
				<div class="center-head-menu1-div">
					<a href="">
						<img src="use_img/fahuo.png"/ >
					</a>
					<p>待发货</p>
				</div>
				<div class="center-head-menu1-div">
					<a href="">
						<img src="use_img/shouhuo.png" />
					</a>
					<p>待收货</p>
				</div>
				<div class="center-head-menu1-div" style="border:none;">
					<a href="">
						<img src="use_img/lishi.png"  />
					</a>
					<p>历史订单</p>
				</div>
			</div>
			
			<div class="shouchang">
				<a href="">
					<img src="use_img/myorder.png"  />
				</a>
			</div>
			<div class="shouchang">
				<a href="">
					<img src="use_img/myshouchang.png"  />
				</a>
			</div>
			<div class="shouchang">
				<a href="">
					<img src="use_img/shezhi.png"  />
				</a>
			</div>
		</div>
		
		
		
    </div>
</div>
























<!--------------------------- list显示商品的列表页面 ----------------------->

<script>
var pageSize = 4;//每页显示多少商品
var currentPage = 0;//当前是第几页

$(function(){
	//初始化
	$('#pageList').live('pageshow', function(event, ui){
		selectGoodsByDateForList();//查寻商品列表
	});
});

function  selectGoodsByDateForList(){
	//商家推荐列表初始化
	$.ajax( {  
      url:AppUrl+'/forestage/Goods/showAllGoods',// 跳转到 action  addUser
      data:{
		"pageSize":pageSize,
		'currentPage':currentPage
	  },  
     type:'post',  
     cache:false,  
     dataType:'json',  
     success:function(data) {  
       // alert("返回数据selectGoodsByDateForList"+data);
		showSelectGoodsByDateForListData(data);//显示商品
      },  
      error : function() {  
           alert("异常！");  
      }  
	});
}




function showSelectGoodsByDateForListData(data){
	var str = '';
		for(var i=0;i<data.length;i++){
			
			str += "<div style='background-color:#FFFFFF;float:left;width:46%;margin-top:5px;margin-left:2px;padding:4px;border:1px solid gray;'>";
				str += "<a  href='#pageDetail' onclick=\"setGoodsInformation('"+data[i]._id+"','"+data[i].goods_name+"','"+data[i].goods_price+"','"+data[i].goods_desc+"','"+data[i].file_name+"')\" >";
					str += "<div style='float:left;width:100%;'>";
						str += "<img style='width:100%;float:left;' src='http://biluo.oss-cn-qingdao.aliyuncs.com/"+data[i].file_name+"' />";
						str += "<div style='float:left;width:100%;text-align:center;font-size:12px;color:black;'>";
							str += "<p style='text-align:center;font-size:15px;text-align:left;'>"+data[i].goods_name+"</p>";
							str += "<p style='text-align:center;font-size:12px;color:red;text-align:left;'>￥:"+data[i].goods_price+"</p>";
					
						str += "</div>";
					str += "</div>";
				str += "</a>";
			str += "</div>";
		
		}
		$("#list-center").append(str);//用append逐渐添加数据
}


function  next(){
	currentPage = parseInt(currentPage)+parseInt(pageSize);
	$.ajax( {  
      url:AppUrl+'/forestage/Goods/showAllGoods',// 跳转到 action  addUser
      data:{
		"pageSize":pageSize,
		'currentPage':currentPage
	  },  
     type:'post',  
     cache:false,  
     dataType:'json',  
     success:function(data) {  
        //alert("返回数据--"+data);
		showSelectGoodsByDateForListData(data);
      },  
      error : function() {  
           alert("异常！");  
      }  
	});
}


</script>



<div data-role="page" id="pageList">
	<div data-role="header"  id='list' style="background-color:orange;" >
	  <a href="#pageOne" data-role="none" style="background-color:orange;">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	  <h2 data-role="none" style="padding:0px;height:40px;" >
		火车票查询
	  </h2>
	  <a href="#" data-role="none" style="" onclick="search_gupiao()">
		
	  </a>
    </div>
	<div data-role="content" id="list-center"></div>
	<a href="#" type="button" style="margin-top:20px;height:40px;width:100%;display:block;text-align:center;color:#09D6F8;font-size:10px;" onclick="next()">加载更多</a>
</div>













<!------------------------------------------ 商品的详情页面 -------------------------------------------->


<script>




$(function() {
	//商品详细显示初始化
	$('#pageDetail').live('pageshow', function(event, ui){
		$("#detail_img").attr("src","http://biluo.oss-cn-qingdao.aliyuncs.com/"+file_name_detail);
		document.getElementById("detail_good_name").innerHTML = "&nbsp;&nbsp;"+goods_name_detail;
		document.getElementById("detail_good_price").innerHTML =  "&nbsp;&nbsp;￥"+ goods_price_detail;
		document.getElementById("detail_good_detail").innerHTML =  "&nbsp;&nbsp;"+ goods_desc_detail;
		
		selectCommentByGoodsId();//查寻该商品对应的所有评论
	});
	
});


function subs(){
	var s = $("#count").val();
	if(s <= 1){
		s = 1;
	}else{
		s--;
	}
	$("#count").val(s);
}

function adds(){
	var s = $("#count").val();
	s++;
	$("#count").val(s);
}


//添加评论
function addComment(){
	var comment_text = $("#comment_text").val();
	$.ajax( {  
      url:AppUrl+'/forestage/comment/addComment',// 跳转到 action  addUser
      data:{
		'comment_text':comment_text,
		'goods_id_detail':goods_id_detail
	  },  
     type:'post',  
     cache:false,  
     dataType:'json', 
	 xhrFields: {
        withCredentials: true
      },
     success:function(data) {  
		if(data == 1){//说明用户没有登录 转到登录页面
			$.mobile.changePage("#pageTwo", "slideup");
		}else if(data == 2){//说明用户已经登录 并且评论成功
			selectCommentByGoodsId();//重新到数据库查询评论数据
		}
      },  
      error : function() {  
           alert("异常！");  
      }  
	});
}

function selectCommentByGoodsId(){
	$.ajax( {  
      url:AppUrl+'/forestage/comment/selectCommentByGoodsId',// 跳转到 action  addUser
      data:{
		'goods_id_detail':goods_id_detail
	  },  
     type:'post',  
     cache:false,  
     dataType:'json',
	 xhrFields: {
        withCredentials: true
      },	 
     success:function(data) {  
		var str = '';
		for(var i=0;i<data.length;i++){
			for(var j=0;j<data[i].comments.length;j++){
				str += "<div style='background-color:#FFFFEE;margin-top:10px;width:100%;float:left;border:1px solid #999999;padding:2px;'>";
				str += data[i].comments[j].comment.user_name+"<br/>"+data[i].comments[j].comment.comment_text;
			}
			str += "<div style='width:100%;float:left;border:1px solid red;padding:2px;'>";
			str += "<div style='float:left;background-color:#F8FCFF;color:#1E50A2;' >"+data[i].user_name+"</div><br/>";
			str += "<div style='float:left;background-color:#F8FCFF;' >&nbsp;&nbsp;"+data[i].comment_text+"</div><br/>";
			str += "<div style='height:30px;border-bottom:2px solid #AFAFB0;float:left;background-color:#F8FCFF;' >";
			str += "<a href='#' onclick=\"anwserCommentByCommentId('"+data[i]._id+"')\"  >回复";
			str += "</a>";
			str += "</div>";
			str += "</div>";
			for(var j=0;j<data[0].comments.length;j++){
				str += "</div>";
			}
			str += "<div style='float:left;width:100%;height:20px;background-color:#F8FCFF;'></div>";
		}
		$("#show_comment").html(str);
		
      },  
      error : function() {  
           alert("异常！");  
      }  
	});
}

//主要用来显示回复框
function anwserCommentByCommentId(id){
	$("#comment_div_method").val(id);//设置隐藏域为要回复的id
	//设置页面滚动到最下面 便于显示输入框
	$('html, body, .content').animate({scrollTop: $(document).height()}, 300); 
}

//真正去存储数据库
function doAnwserCommentByCommentId(){
	var comment_id = $("#comment_div_method").val();
	var comment_text = $("#comment_text").val();
	$.ajax( {  
      url:AppUrl+'/forestage/comment/doAnwserCommentByCommentId',// 跳转到 action  addUser
      data:{
		'comment_id':comment_id,
		'comment_text':comment_text,
		'goods_id_detail':goods_id_detail
	  },  
     type:'post',  
     cache:false,  
     dataType:'json',  
     success:function(data) {  
        alert("返回数据--"+data);
		if(data == 3){//说明用户没有登录 转到登录页面
			$.mobile.changePage("#pageTwo", "slideup");
		}else if(data == 2){//说明用户已经登录 并且评论成功
			selectCommentByGoodsId();//重新到数据库查询评论数据
		}else if(data == 1){//说明用户已经登录 并且评论成功
			alert("系统出错");
		}
      },  
      error : function() {  
           // view("异常！");  
           alert("异常！");  
      }  
	});
	
	//清除要提交的隐藏信息
	$("#comment_div_method").val("");
	
}



//使用同一个输入框 如果隐藏字段为空 就新加评论  否者就是回复评论
function addComment_div_method(){
	var comment_div_method = $("#comment_div_method").val();
	if(comment_div_method == null || comment_div_method == ''){
		addComment();
	}else{
		doAnwserCommentByCommentId();
	}

}


</script>



<div data-role="page" id="pageDetail">
	<div data-role="header" id='detail'>
	  <a href="#pageOne" data-role="none" style="">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	  <h1 data-role="none" id="detail-title" >
		详情
	  </h1>
	  <a href="#" data-role="none" style=""></a>
    </div>
	<div data-role="content" id="list-center">
		<div id="test" class="showPicture" >
				<img src="temp_img/close1.png" style="display:block;" id="detail_img"  class="showImgHand"/>
		</div>
		<div  id="showPicture-text" >
				<p id="detail_good_name" style="color:black;font-size:15px;font-weight:bold;">尚雷思女式套装尚雷思女式套装尚雷思女式套装尚雷思女式套装尚雷思女式套装尚雷思女式套装</p>
				<p id="detail_good_detail" style="color:black;font-size:15px;font-weight:bold;">尚雷思女式套装尚雷思女式套装尚雷思女式套装尚雷思女式套装尚雷思女式套装尚雷思女式套装</p>
				<p id="detail_good_price" style="color:red;font-size:25px;font-weight:bold;">&nbsp;&nbsp;￥99</p>	
				<!--MOB SHARE BEGIN-->
				<div class="-mob-share-ui-button -mob-share-open">分享</div>
				<div class="-mob-share-ui" style="display: none">
					<ul class="-mob-share-list">
						<li class="-mob-share-weibo"><p>新浪微博</p></li>
						<li class="-mob-share-tencentweibo"><p>腾讯微博</p></li>
						<li class="-mob-share-qzone"><p>QQ空间</p></li>
						<li class="-mob-share-qq"><p>QQ好友</p></li>
						<li class="-mob-share-weixin"><p>微信</p></li>
						<li class="-mob-share-douban"><p>豆瓣</p></li>
						<li class="-mob-share-renren"><p>人人网</p></li>
						<li class="-mob-share-kaixin"><p>开心网</p></li>
						<li class="-mob-share-facebook"><p>Facebook</p></li>
						<li class="-mob-share-twitter"><p>Twitter</p></li>
						<li class="-mob-share-pocket"><p>Pocket</p></li>
						<li class="-mob-share-google"><p>Google+</p></li>
						<li class="-mob-share-youdao"><p>有道云笔记</p></li>
						<li class="-mob-share-mingdao"><p>明道</p></li>
						<li class="-mob-share-pengyou"><p>朋友网</p></li>
						<li class="-mob-share-tumblr"><p>Tumblr</p></li>
						<li class="-mob-share-instapaper"><p>Instapaper</p></li>
						<li class="-mob-share-linkedin"><p>LinkedIn</p></li>
					</ul>
					<div class="-mob-share-close">取消</div>
				</div>
				<div class="-mob-share-ui-bg"></div>
				<script id="-mob-share" src="http://f1.webshare.mob.com/code/mob-share.js?appkey=1593d6e8a5b34"></script>
				<!--MOB SHARE END-->
				<form>
					
					<input data-role="none"type="button" value="-" id="sub" onclick="subs()"/>
					<input data-role="none" type="text" value="1" id="count">
					<input data-role="none" type="button" value="+"  id="add" onclick="adds()"/>
				</form>
				<input data-role="none" type="button" value="立即购买"   id="byNow"/>
				<input data-role="none" type="button" value="加入购物车" id="addToCart"/>
		</div>
		<!--评论显示--->
		<div id="show_comment" style="width:100%;"></div>
		<textarea  id="comment_text" style="width:100%;height:100px;" ></textarea>
		<input type="hidden" id="comment_div_method" style="width:100%;" />
		<input type="button" style="width:100%;" onclick="addComment_div_method()" value="评论"/>
	  </div>
</div>

















<!---------------------------------------------百度地图--------------------------------------------------------->

<script>
var map  = null;  //设置全局的一个map

$(function() {

	$('#pageMap').live('pageshow', function(event, ui){
		//省市联动
		$("#selectLocation1").ProvinceCity();
		$("#selectLocation2").ProvinceCity();
		
		var mapHeight = $(window).height(); //浏览器当前窗口可视区域高度 
		$("#container").css("height",(mapHeight-100));
		//获取浏览器当前位置   ---- 目前只能获取到市  不能精准到每个人的地方
		var a = null;
		var b = null;
		
		var geolocation = new BMap.Geolocation();
		geolocation.getCurrentPosition(function(r){
			if(this.getStatus() == BMAP_STATUS_SUCCESS){
				var mk = new BMap.Marker(r.point);
				map.addOverlay(mk);
				map.panTo(r.point);
				//alert('您的位置：'+r.point.lng+','+r.point.lat);//这一点获取的坐标延迟比较长
				a = r.point.lng;
				b = r.point.lat;
			}
			else {
				alert('failed'+this.getStatus());
			}        
		},{enableHighAccuracy: true})
		
		//alert("a="+a);//这里获取的坐标是空值   因为上面获取的速度太慢
		// 百度地图API功能
		map = new BMap.Map("container");
		var point = new BMap.Point(a,b);
		map.centerAndZoom(point,12);
		
		//给地图添加控件
		map.addControl(new BMap.NavigationControl());
		map.addControl(new BMap.NavigationControl());    
		map.addControl(new BMap.ScaleControl());    
		map.addControl(new BMap.OverviewMapControl());    
		map.addControl(new BMap.MapTypeControl());    
		

		//驾车  公交路线搜索
		$('#road_search').click(function(){ 
		
		
			var sheng = $("#road_sheng").val();
			var shi = $("#road_shi").val();
			var weizhi = sheng+shi;
			var myGeo = new BMap.Geocoder();
			// 将地址解析结果显示在地图上,并调整地图视野
			myGeo.getPoint(weizhi, function(point){
				if (point) {
					map.centerAndZoom(point, 16);
					map.addOverlay(new BMap.Marker(point));
				}else{
					alert("您选择地址没有解析到结果!");
				}
			}, sheng);
		
			var start = $("#suggestId1").val(); 
			var end = $("#suggestId2").val();
			var method = $("input[name='method']:checked").val();
			//alert("start="+start+" end="+end+"-----"+method);
			if(method == 1){
				var transit = new BMap.TransitRoute(map, {
					renderOptions: {map: map, panel: "r-result"}, 
					onResultsHtmlSet : function(){$("#r-result").show()}  	
				});
			
				transit.search(start,end);
			}else if(method == 2){
				var driving = new BMap.DrivingRoute(map, {renderOptions: {map: map, panel: "r-result", autoViewport: true}});
				driving.search(start, end);
			}
		});
		
		
		
	});
});

//精准 搜索
function serachRoad(){
		var sheng = $("#serachRoad_sheng").val();
		var shi = $("#serachRoad_shi").val();
		var qu = $("#serachRoad_qu").val();
		var local = $("#suggestId3").val();
		var weizhi = sheng+"省"+shi+"市"+qu+local;
		//alert(weizhi);
		var myGeo = new BMap.Geocoder();
		// 将地址解析结果显示在地图上,并调整地图视野
		myGeo.getPoint(weizhi, function(point){
			if (point) {
				map.centerAndZoom(point, 16);
				map.addOverlay(new BMap.Marker(point));
			}else{
				alert("您选择地址没有解析到结果!");
			}
		}, sheng);
}

//周边搜索
function searchNear(){
	var text = $("#near_search_text").val();
	var local = new BMap.LocalSearch(map,   
              { renderOptions:{map: map}});      
	local.searchInBounds(text, map.getBounds());
}

</script>

<div data-role="page" id="pageMap">
	<div data-role="panel" id="searchRoadDivPanel"> 
		<!----路线精准搜索--->
		<div id="searchRoad"  style="width:100%;position:relative;display:block;">
			<div data-role="none" id="selectLocation1">
				<table>
					<tr>
						<td>选择省:</td>
						<td><select id="serachRoad_sheng" data-role="none" style='width:100px;height:40px;margin-left:20px;float:left;'></select></td>
					</tr>
					<tr>
						<td>选择市:</td>
						<td><select id="serachRoad_shi" data-role="none" style='width:100px;height:40px;margin-left:20px;float:left;'></select></td>
					</tr>
					<tr>
						<td>选择区:</td>
						<td><select id="serachRoad_qu"  data-role="none" style='width:100px;height:40px;margin-left:20px;float:left;'></select></td>
					</tr>
					<tr>
						<td><input data-role="none"  type="text" value="起点" style="width:100px;float:left;" id="suggestId3" /></td>
						<td><input data-role="none"  type="button" value="搜索" onclick="serachRoad()" style="width:100px;float:left;"  /></td>
					</tr>
				</table>

			</div>
		</div>
	</div>
	<div data-role="panel" id="nearDivPanel"> 
			<!----周边搜索--->
		<div id="nearDiv"  style="width:100%;">
			<input data-role="none"  type="text" value="搜索" id="near_search_text"			style="width:100%;height:50px;float:left;"  />
			<input data-role="none"  type="button" value="搜索" id="near_search_bt"			style="width:100%;height:50px;float:left;" onclick="searchNear()" />
		</div>
		
	</div>
	<div data-role="panel" id="roadDivPanel"> 
		<!----路线导航 驾车  公交--->
		<div id="roadDiv"   style="width:100%;">
			<div data-role="none" id="selectLocation2">
				<table>
					<tr>
						<td>选择省:</td>
						<td><select id="road_sheng" data-role="none" style='width:100px;height:40px;margin-left:20px;float:left;'></select></td>
					</tr>
					<tr>
						<td>选择市:</td>
						<td><select id="road_shi" data-role="none" style='width:100px;height:40px;margin-left:20px;float:left;'></select></td>
					</tr>
					<tr>
						<td>选择区:</td>
						<td><select id="road_qu"  data-role="none" style='width:100px;height:40px;margin-left:20px;float:left;display:none;'></select></td>
					</tr>
					<tr>
						<td><input data-role="none" name="method" type="radio" value="1" checked="true" />公交 </td>
						<td><input data-role="none" name="method" type="radio" value="2" />驾车</td>
					</tr>
					<tr>
						<td>起点:</td>
						<td><input data-role="none"  type="text" value="起点"   id="suggestId1"  style='width:100px;height:40px;margin-left:20px;float:left;'  /></td>
					</tr>
					<tr>
						<td>终点:</td>
						<td><input data-role="none"  type="text" value="起点"   id="suggestId2"  style='width:100px;height:40px;margin-left:20px;float:left;'  /></td>
					</tr>
					<tr>		
						<td colspan="2"><input data-role="none"  type="button" value="搜索" id="road_search" style="width:100%;float:left;"  /></td>
					</tr>
				</table>
			</div>
			<div id="searchResultPane" style="width:100%; display:none;position:relative;z-index:100;float:left; "></div>
		</div>
		<div id="r-result" style="display:none;position:relative;z-index:30;"></div>
	</div>
    <div data-role="header" style="background-color:orange;" >
	  <a href="#pageOne" data-role="none" style="background-color:orange;">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	  <h1 data-role="none"  >
		百度地图
	  </h1>
	  <a href="#" data-role="none" style=""></a>
    </div>
    <div data-role="content" style="width:100%;height:100%;padding:0px;margin-left:0px;position:relative;z-index:2;">
		<!--百度地图显示-->
		<div id="container" style="width:100%;height:400px;position:relative;"></div> 	
    </div>
	<div data-role="footer" data-position="fixed" >
			<div data-role="navbar" >
				<ul >
					<li >
						<a href="#searchRoadDivPanel" data-icon="home">精准地点</a>
					</li>    
					<li>
						<a href="#nearDivPanel" data-icon="search" >附近</a>
					</li >
					<li s>
						<a href="#roadDivPanel" data-icon="arrow-u" >路线</a>
					</li>   
				</ul>
			</div>
	</div>
</div>
	




	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
<!-------------------------------天气的页面-------------------------------------------->	


<script>

var weatherMap = null;

$(function() {
	$('#weatherPage').live('pageshow', function(event, ui){
		weatherMap = new BMap.Map("weather_map");
		var mapHeight = $(window).height(); //浏览器当前窗口可视区域高度 
		$("#weatherContent").css("height",(mapHeight));
		//获取浏览器当前位置   ---- 目前只能获取到市  不能精准到每个人的地方
		var geolocation = new BMap.Geolocation();
		geolocation.getCurrentPosition(function(r){
			if(this.getStatus() == BMAP_STATUS_SUCCESS){
				var mk = new BMap.Marker(r.point);
				weatherMap.addOverlay(mk);
				weatherMap.panTo(r.point);
				alert('您的位置：'+r.point.lng+','+r.point.lat);//这一点获取的坐标延迟比较长
				var a = r.point.lng;
				var b = r.point.lat;
				
				var point = new BMap.Point(a,b);
				var geoc = new BMap.Geocoder();    
				geoc.getLocation(point, function(rs){
					var addComp = rs.addressComponents;
					//alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
					var urlStr = "http://api.map.baidu.com/telematics/v3/weather?location="+addComp.city+"&output=json&ak=6jkW1Yf80yMKrt04PelTDgKDQ5A6rKYc";
					searchWeather(urlStr);
				});        	
			}
			else {
				alert('failed'+this.getStatus());
			}        
		},{enableHighAccuracy: true})
	});	
});

//搜索框搜索指定城市天气
function searchCityWeather(){
	var weather_search_text = $("#weather_search_text").val();
	var urlStr = "http://api.map.baidu.com/telematics/v3/weather?location="+weather_search_text+"&output=json&ak=6jkW1Yf80yMKrt04PelTDgKDQ5A6rKYc";
	searchWeather(urlStr);
}

//请求天气 API使用的是这个http://developer.baidu.com/map/wiki/index.php?title=car/api/weather&qq-pf-to=pcqq.group#.E6.8E.A5.E5.8F.A3.E8.AF.B4.E6.98.8E
function searchWeather(urlStr){
		$.ajax({
			url:urlStr,
			type : 'post',
			cache : false,
			dataType : 'jsonp',
			success : function(data) {
					document.getElementById("weather_cityName").innerHTML = data.results[0].currentCity;
					var weather_statusText = data.results[0].weather_data[0].date +"   "+data.results[0].weather_data[0].weather;
					document.getElementById("weather_statusText").innerHTML = weather_statusText;
					document.getElementById("weather_du").innerHTML = data.results[0].weather_data[0].temperature;
			
					var str = '';
					for(var i=1;i<data.results[0].weather_data.length;i++){
						str +="<div style='float:left;width:100%;height:40px;'>";
							str +="<div style='float:left;width:30%;height:100%;'>";
							str += data.results[0].weather_data[i].date;
							str +="</div>";
							str +="<div style='float:left;width:30%;height:100%;'>";
							str += data.results[0].weather_data[i].weather;
							str +="</div>";
							str +="<div style='float:left;width:40%;height:100%;'>";
							str += data.results[0].weather_data[i].temperature;
							str +="</div>";
						str +="</div>";
					}
					document.getElementById("weather_weilai").innerHTML = str;
			}
		});
}

</script>
	
<div data-role="page" id="weatherPage">
    <div data-role="header" style="background-color:orange;" >
	  <a href="#pageOne" data-role="none" style="background-color:orange;">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	  <h1 data-role="none"  >
		<input type="text" id="weather_search_text" data-role="none"  value="" style="width:100%;height:30px;;float:left;padding:0px;margin:0px;border:none;background-color:transparent;border-bottom:1px solid #c9c4c4;color:#C3F4FA;"/>
	  </h1>
	  <a href="#" data-role="none"  onclick="searchCityWeather()" >
			<img src="use_img/search.png" width="30px" height="30px;"/>
	  </a>
    </div>
    <div data-role="none" id="weatherContent" style="width:100%;padding:0px;margin-left:0px;position:relative;z-index:2;background-image:url('use_img/weather_div_bg2.png');background-size:100% 100% ;">
		<div id="weather_cityName" style="width:80%;height:40px;margin-top:40px;float:left;margin-left:20px;text-align:center;font-size:25px;color:#C3F4FA;"></div>
		<div id="weather_statusText" style="width:80%;float:left;margin-left:20px;text-align:center;font-size:18px;line-height:45px;color:#C3F4FA;"></div>
		<div id="weather_du" style="width:80%;height:100px;float:left;margin-left:20px;text-align:center;font-size:50px;line-height:100px;color:#C3F4FA;"></div>
		<div id="weather_weilai" style="margin-top:20px;width:80%;float:left;margin-left:20px;text-align:center;color:#C3F4FA;"></div>
	</div>
</div>
	


	
	
	


<!------------------------股票页面----------------------------------------->

<script>
$(function() {
	$('#gupiaoPage').live('pageshow', function(event, ui){
		var searchlist = "sh601006";
		do_search_gupiao(searchlist);
	});
});

function search_gupiao(){
	var searchlist = $("#search_gupiao_text").val();
	do_search_gupiao(searchlist);
}

function do_search_gupiao(searchlist){
	$.ajax({
			 url:AppUrl+'/forestage/GuPiao/getGupiaoData',
			 dataType:'json',
			 data:{
				'list':searchlist
			 },
			 type:'post',
			 success:function(data){
			   //alert(data);
			   $("#GuPiao_name").html(data[0]);
			   var adds = data[2]-data[1];
			   if(parseInt(adds) < 0){
					 $("#GuPiao_BiJiao").html("-"+parseInt(adds));
			   }else if(parseInt(adds) == 0){
					 $("#GuPiao_BiJiao").html(""+parseInt(adds));
			   }else{
					 $("#GuPiao_BiJiao").html("+"+parseInt(adds));
			   }
			   
			    $("#GuPiao_today_kaipan").html("今日开盘价:"+data[1]);
				$("#GuPiao_yesday_shoupan").html("昨日收盘价:"+data[2]);
				$("#GuPiao_current_price").html("当前价格:"+data[3]);
				$("#GuPiao_heighAndLow_price").html("今日最高价:"+data[4]+"&nbsp;&nbsp;今日最低价:"+data[5]);
				
				$("#GuPiao_MaiMai_price1").html("&nbsp;&nbsp;竞买价:"+data[6]);
				$("#GuPiao_MaiMai_price2").html("&nbsp;&nbsp;竞卖价:"+data[7]);
				$("#GuPiao_count1").html("&nbsp;&nbsp;成交股票数:"+data[8]);
				$("#GuPiao_count2").html("&nbsp;&nbsp;成交金额:"+parseInt(data[9])/10000+"(万)");
				$("#mai_10").html(data[10]+"");
				$("#mai_11").html(data[11]+"");
				$("#mai_12").html(data[12]+"");
				$("#mai_13").html(data[13]+"");
				$("#mai_14").html(data[14]+"");
				$("#mai_15").html(data[15]+"");
				$("#mai_16").html(data[16]+"");
				$("#mai_17").html(data[17]+"");
				$("#mai_18").html(data[18]+"");
				$("#mai_19").html(data[19]+"");
				$("#mai_20").html(data[20]+"");
				$("#mai_21").html(data[21]+"");
				$("#mai_22").html(data[22]+"");
				$("#mai_23").html(data[23]+"");
				$("#mai_24").html(data[24]+"");
				$("#mai_25").html(data[25]+"");
				$("#mai_26").html(data[26]+"");
				$("#mai_27").html(data[27]+"");
				$("#mai_28").html(data[28]+"");
				$("#mai_29").html(data[29]+"");
				$("#GuPiao_date").html(data[30]+"&nbsp;&nbsp;"+data[31]+"&nbsp;&nbsp;");
				$("#gupiao_img_1").attr("src","http://image.sinajs.cn/newchart/min/n/"+searchlist+".gif");
				$("#gupiao_img_2").attr("src","http://image.sinajs.cn/newchart/daily/n/"+searchlist+".gif");
				$("#gupiao_img_3").attr("src","http://image.sinajs.cn/newchart/weekly/n/"+searchlist+".gif");
				$("#gupiao_img_4").attr("src","http://image.sinajs.cn/newchart/monthly/n/"+searchlist+".gif");
			 },
			 error:function(XMLHttpRequest, textStatus, errorThrown) {
			   //alert(XMLHttpRequest.status);
			   //alert(XMLHttpRequest.readyState);
			   //alert(textStatus);
			}
		});
}
</script>


<div data-role="page" id="gupiaoPage">
    <div data-role="header" style="background-color:orange;" >
	  <a href="#pageOne" data-role="none" style="background-color:orange;">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	  <h2 data-role="none" style="padding:0px;height:40px;" >
		<input data-role="none" id="search_gupiao_text" type="text" style="height:25px;margin-top:5px;border:none;border-bottom:1px solid #FFFFFF;background-color:transparent;"/>
	  </h2>
	  <a href="#" data-role="none" style="" onclick="search_gupiao()">
		<img src="use_img/search.png" width="30px" height="30px;"/>
	  </a>
    </div>
    <div data-role="none" id="dupiaoContent" style="width:100%;padding:0px;margin-left:0px;">
		<div id="GuPiao_name" style="float:left;width:100%;height:40px;background-color:#E84C4B;text-align:center;font-size:26px;color:#FFFFFF;"></div>
		<div id="GuPiao_BiJiao" style="float:left;width:30%;height:100px;background-color:#E84C4B;text-align:center;font-size:60px;color:#FFFFFF;"></div>
		
		<div id="GuPiao_today_kaipan" style="float:left;width:70%;height:25px;background-color:#E84C4B;text-align:left;font-size:12px;color:#FFFFFF;"></div>
		<div id="GuPiao_yesday_shoupan" style="float:left;width:70%;height:25px;background-color:#E84C4B;text-align:left;font-size:12px;color:#FFFFFF;"></div>
		<div id="GuPiao_current_price" style="float:left;width:70%;height:25px;background-color:#E84C4B;text-align:left;font-size:12px;color:#FFFFFF;"></div>
		<div id="GuPiao_heighAndLow_price" style="float:left;width:70%;height:25px;background-color:#E84C4B;text-align:left;font-size:12px;color:#FFFFFF;"></div>
		
		<div id="GuPiao_MaiMai_price1" style="float:left;width:50%;height:25px;background-color:#E84C4B;text-align:left;font-size:12px;color:#FFFFFF;"></div>
		<div id="GuPiao_MaiMai_price2" style="float:left;width:50%;height:25px;background-color:#E84C4B;text-align:left;font-size:12px;color:#FFFFFF;"></div>
		<div id="GuPiao_count1" style="float:left;width:50%;height:25px;background-color:#E84C4B;text-align:left;font-size:12px;color:#FFFFFF;"></div>
		<div id="GuPiao_count2" style="float:left;width:50%;height:25px;background-color:#E84C4B;text-align:left;font-size:12px;color:#FFFFFF;"></div>
		
		<div id="gupiao_table" >
			<table >
				<tr >
					<td style="background-color:#DDF581;">买/卖</td>
					<td>一</td>
					<td>二</td>
					<td>三</td>
					<td>四</td>
					<td>五</td>
				</tr>
				<tr >
					<td style="background-color:#DDF121;">买(申请)</td>
					<td id="mai_10"></td>
					<td id="mai_12"></td>
					<td id="mai_14"></td>
					<td id="mai_16"></td>
					<td id="mai_18"></td>
				</tr>
				<tr >
					<td style="background-color:#DDF121;">买(报价)</td>
					<td id="mai_11"></td>
					<td id="mai_13"></td>
					<td id="mai_15"></td>
					<td id="mai_17"></td>
					<td id="mai_19"></td>
				</tr>
				<tr >
					<td style="background-color:#12F581;">卖(申请)</td>
					<td id="mai_20"></td>
					<td id="mai_22"></td>
					<td id="mai_24"></td>
					<td id="mai_26"></td>
					<td id="mai_28"></td>
				</tr>
				<tr >
					<td style="background-color:#12F581;">卖(报价)</td>
					<td id="mai_21"></td>
					<td id="mai_23"></td>
					<td id="mai_25"></td>
					<td id="mai_27"></td>
					<td id="mai_29"></td>
				</tr>
			</table>
		</div>
		<div id="GuPiao_date" style="float:left;width:100%;height:25px;background-color:#FFFFFF;text-align:right;font-size:12px;color:#000000;"></div>
		<img src="" id="gupiao_img_1" style="width:100%;"/><br/><br/>
		<img src="" id="gupiao_img_2" style="width:100%;"/><br/><br/>
		<img src="" id="gupiao_img_3" style="width:100%;"/><br/><br/>
		<img src="" id="gupiao_img_4" style="width:100%;"/><br/><br/>
	</div>
</div>




















<!----------------------------火车票查询----------------------------------------->


<script>

var arrayObj = new Array();　//创建一个数组
var station_city_obj = null;
$(function() {
	$('#pageTrain').live('pageshow', function(event, ui){
		searchTrain();
	});
});


function  searchTrain(){
	var str = "";
	$.ajax( {  
			  url:AppUrl+'/forestage/Train/searchTrain',// 跳转到 action  addUser
			  data:{
			  },  
			 type:'post',  
			 cache:false,  
			 dataType:'json',  
			 success:function(data) {  
				//alert("返回数据searchTrain1--"+data);
				station_city_obj = data;
				//alert("返回数据searchTrain2--"+station_city_obj);
			  },  
			  error : function() {  
				   alert("异常！");  
			  }  
		});
}

function  selectTrain(){
	//alert("返回数据searchTrain3--"+station_city_obj['北京']);
	var  trail_start = $("#trail_start").val();
	var  trail_end = $("#trail_end").val();
	var  trail_date = $("#trail_date").val();
	var  trail_start_code = station_city_obj[trail_start];
	var  trail_end_code = station_city_obj[trail_end];
	$.ajax( {  
			  url:AppUrl+'/forestage/Train/selectTrain',// 跳转到 action  addUser
			  data:{
				'date':trail_date,
				'start':trail_start_code,
				'end':trail_end_code
			  },  
			 type:'post',  
			 cache:false,  
			 dataType:'json',  
			 success:function(data) {  
				//alert("返回数据searchTrain1--"+data);
				showSelectTrain(data);
			  },  
			  error : function() {  
				   // view("异常！");  
				   alert("异常！");  
			  }  
	});
}


function  showSelectTrain(data){
	var str = '';
	for(var i=0;i<data.data.datas.length;i++){
		//alert("+++"+data.data.datas[i].train_no);
		str += "<div style='width:100%;margin-top:20px;float:left;border-bottom:2px solid #E0E0E0;'>";
		str += "<div style='font-weight:bold;width:24%;height:30px;float:left;'>"+data.data.datas[i].start_time+"</div>";
		str += "<div style='font-size:15px;width:24%;height:30px;float:left;'>"+data.data.datas[i].from_station_name+"</div>";
		str += "<div style='color:#5BD0A9;font-size:15px;width:24%;height:30px;float:left;'>"+data.data.datas[i].station_train_code+"</div>";
		str += "<div style='width:24%;height:30px;float:left;'>"+"价格"+"</div>";
		
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+data.data.datas[i].arrive_time+"</div>";
		str += "<div style='font-size:15px;width:24%;height:30px;float:left;'>"+data.data.datas[i].to_station_name+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+data.data.datas[i].lishi+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+"</div>";
		
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+"商务"+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+data.data.datas[i].swz_num+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+"一等"+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+data.data.datas[i].zy_num+"</div>";
		
		
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+"二等"+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+data.data.datas[i].ze_num+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+"硬座"+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+data.data.datas[i].yz_num+"</div>";
		
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+"硬卧"+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+data.data.datas[i].yw_num+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+"无座"+"</div>";
		str += "<div style='font-size:12px;width:24%;height:30px;float:left;'>"+data.data.datas[i].wz_num+"</div>";
		
		str += "</div>";
	}
	
	$("#ShowTrainPicket").html(str);
}


function exchangeTrainDirection(){
	var  trail_start = $("#trail_start").val();
	var  trail_end = $("#trail_end").val();
	$("#trail_start").val(trail_end);
	$("#trail_end").val(trail_start);
}

</script>



<div data-role="page" id="pageTrain">

    <div data-role="header" style="background-color:orange;" >
	  <a href="#pageOne" data-role="none" style="background-color:orange;">
			<img src="use_img/login_back.png" width="30px" height="30px;"/>
		</a>
	  <h2 data-role="none" style="padding:0px;height:40px;" >
		火车票查询
	  </h2>
	  <a href="#" data-role="none" style="" onclick="search_gupiao()">
		
	  </a>
    </div>
    <div data-role="none" id="train_Content" style="width:100%;padding:0px;margin-left:0px;">
		<div  style="width:100%;float:left;">
			<div style="width:40%;height:40px;float:left;">
				<input data-role="none" id="trail_start" type="text" style="width:90%;height:90%;border:none;border-bottom:1px solid #D2D2D2;"/>
			</div>
			<div style="width:20%;height:40px;float:left;">
				<a href="#" onclick="exchangeTrainDirection()">
						<img src="use_img/train_reverse.png" width="100%" height="100%"/>
				</a>
			</div>
			<div style="width:38%;height:40px;float:left;">
				<input data-role="none" id="trail_end"  type="text" style="width:90%;height:90%;margin-left:5px;border:none;border-bottom:1px solid #D2D2D2;"/>
			</div>
			<div style="width:100%;height:40px;float:left;">
				
				<input  type="date" id="trail_date" style="width:100%;height:100%;border:none;border-bottom:1px solid #D2D2D2;"/>
			</div>
			<div style="width:100%;height:40px;float:left;">
				<input  type="button" value="查寻" onclick="selectTrain()" style="background-color:#41C474;width:100%;height:100%;"/>
			</div>
			<div id="ShowTrainPicket" style="width:100%;float:left;"></div>
		</div>
	</div>
</div>

</body>
</html>


